<!DOCTYPE html>
<html  lang="zh-CN">
<head>
  <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
  <meta content=always name=referrer>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="format-detection" content="telephone=no"/>
  <meta name="keywords" content=""/>
  <meta name="description" content=""/>
  <title>支付</title>
  <link rel="stylesheet" type="text/css" href="__STATIC__/css/bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="__STATIC__/css/swiper.min.css">
  <link rel="stylesheet" type="text/css" href="__STATIC__/css/base.css">
  <script src="__STATIC__/js/jquery-1.11.3.min.js"></script>
  <script src="__STATIC__/js/common.js"></script>
  <script src="__STATIC__/js/jquery.form.min.js"></script>
  <script src="__STATIC__/layer/layer.js"></script>
  <script src="__STATIC__/js/Validform_v5.3.2_min.js"></script>
  <script src="__STATIC__/js/Validform_Datatype.js"></script>
  <script src="__STATIC__/dialog/js/mh_dialog.js"></script>
</head>
<body>
<div class="wrap">
  <div class="payment_con">
    <div class="payment_title">成功提交订单</div>

    <div class="order_det">
      <div class="order_title"><span>收货人信息</span><a href="javascript:add_address();" class="right">新增收货地址</a></div>
      <div class="det">
        {if condition="$address"}
        <span class="active_address">{$address.name}  {$address.area_info}  {$address.address}     {$address.phone}</span>
        <a href="javascript:other_address();" class="right" style="font-size: 12px;color: #0153A1;line-height: 30px;margin-top: 26px;">更多收货地址</a>
        {else/}
        {notempty name="address_list"}
        <a onclick="other_address();">
          <a href="javascript:other_address();" class="right" style="font-size: 12px;color: #0153A1;line-height: 30px;">去选择收货地址</a>
        </a>
        {/notempty}
        {/if}
      </div>
    </div>

    <div id="dizhi" style="display: none;">
      <table border="0" style="margin-left: 20px;">
        <tr>
          <td class="name text-center" style="width: 80px;">收货人</td>
          <td class="area text-center" style="width: 200px;">所在地区</td>
          <td class="address text-center" style="width: 400px;">详细地址</td>
          <td class="phone text-center" style="width: 100px;">电话/手机</td>
          <td class="operate text-center" style="width: 133px;">操作</td>
        </tr>
        {volist name="address_list" id="vo"}
        <tr>
          <td class="name text-center" style="text-align:center">{$vo.name}</td>
          <td class="area text-left" style="text-align:center">{$vo.area_info}</td>
          <td class="address text-center" style="text-align:center">{$vo.address}</td>
          <td class="phone text-center" style="text-align:center">{$vo.phone}</td>
          <td class="primary text-center"><span><a href="javascript:chose_address({$vo.id});" style="color: black;">选择该地址</a></span></td>
        </tr>
        {/volist}
      </table>
    </div>

    <div class="payment_main">
      <div class="order_det">
        <div class="title">请选择支付方式！</div>
        <div class="det">订单号：{$find['order_number']}<br>
        </div>
      </div>
    </div>
    <div class="payment_title">平台支付<div class="number right">需支付金额：<span>￥{$find['price']}</span></div></div>
    <div class="payment_main">
      <ul class="list_payment">
        <li>
          <input type="radio" class="radio" id="radio_1" name="radio-1-set" value="支付宝"/>
          <label for="radio_1"><img src="__STATIC__/img/icon76.png"></label>
        </li>
        <li>
          <input type="radio" class="radio" id="radio_2" name="radio-1-set" value="微信"/>
          <label for="radio_2"><img src="__STATIC__/img/icon77.png"></label>
        </li>
        <li>
          <input type="radio" class="radio" id="radio_3" name="radio-1-set" value="余额支付" checked/>
          <label for="radio_3"><img src="__STATIC__/img/icon78.png"></label>
        </li>
      </ul>
      <input type="hidden" id="order_number" value="{$find['order_number']}">
      <input type="hidden" id="price" value="{$find['price']}">
      <input type="hidden" id="information_wechat" value="{$information_wechat}">
      <input type="hidden" id="information_alipy" value="{$information_alipy}">
      <input type="submit" class="submit" value="立即支付" onclick="payment_order()">
    </div>
    <div id="alipay" hidden></div>
  </div>
</div>
<script>
  // 判断支付方式
  function payment_order() {
    var way = $("input[name='radio-1-set']:checked").val();
    if (way=='余额支付') {
      balance_payment(way);
    }else if(way=='微信'){
      wechat_payment(way);
    }else {
      alipay_payment(way);
    }
  }

  // 余额支付功能
  function balance_payment(way) {
    // 获取订单号shop_order_number
    var order_number = $("#order_number").val();
    // 跳转到余额支付页面
    location.href ="{:url('shop/payment/payment_order')}?order_number="+order_number;


  }

  // 支付宝支付
  function alipay_payment() {
    var order_number = $("#order_number").val();
    var information = $("#information_alipy").val();

    $.ajax({
      url : "{:url('shop/Alipay/auction')}",
      type:'post',
      dataType:'html',
      data:{'order_number':order_number,'body' : information},
      success:function (data) {
        $('#alipay').html(data);
      },
      error: function () {
        layer.open({content:'网络繁忙,请重试',skin:'msg',time:2});
      }
    })

  }

  // 微信支付
  function wechat_payment() {
    var order_number = $("#order_number").val();
    var information = $("#information_wechat").val();
    var goods_id = $('#good_ids').val();
    location.href = "{:url('shop/WeChat/auction')}?order_number="+order_number+"&body="+information;
  }
</script>
</body>
</html>
